#pragma once
#include <QWidget>
#include "ui_expressionWidget.h"
#include "BaseFeature.h"
class modelSoft;

QT_BEGIN_NAMESPACE
namespace Ui { class expressionWidgetClass; };
QT_END_NAMESPACE

class expressionWidget : public QWidget
{
	Q_OBJECT

public:
	expressionWidget(modelSoft* myModelSoft, QWidget *parent = nullptr);
	~expressionWidget();
	void addExpression(BaseFeature* feature);

protected:
	void updateFeature(BaseFeature* selectedFeature, double value);
	void createConnection();
	void onItemClicked(QTableWidgetItem* item);
	void onEditExpressionButtonClicked();
	void onModify();
	virtual void closeEvent(QCloseEvent* event) override;
	void onConfirm();

private:
	Ui::expressionWidgetClass *ui;
	modelSoft* myModelSoft;
	double lastExpressionValue;
	bool confirm = false;
	bool modify = false;
	bool featureModify = false;
	int selectedRow = -1;
	BaseFeature* selectedFeature;
};
